package me.xiaoxing365;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;

public class Rreducer extends org.apache.hadoop.mapreduce.Reducer<Text,IntWritable,Text,IntWritable>{
    //定义i为整数类型变量
    int i;
    //新new了一个对象IntWritable，并命名为v
    IntWritable v = new IntWritable();
    /**
     * @param reduce
     * 
     */
@Override
protected void reduce(Text key, Iterable<IntWritable> value,Context context) throws IOException, InterruptedException {
    i = 0;
    for (IntWritable count : value) {
        i += count.get();
    }
    v.set(i);
    context.write(key, v);
}

}
